package main

import (
	"errors"
	"fmt"
)

func customErrors() {
	var e = errors.New("Custom Error")
	if e != nil {
		fmt.Println("Custom Errors : ", e.Error(), e)
	}
}

func test1(a, b float64) (float64, error) {
	if a == 0 {
		return 0, &MyError{when: "test2", what: "test2"}
	}
	return a - b, nil
}

type MyError struct {
	when string
	what string
}

func (e *MyError) Error() string {
	return e.when + " kso: " + e.what + "kso: " + e.when
}
func test2() error {
	return &MyError{when: "test2", what: "test2"}
}
